/*
 * OrderDetailProgressListItem.java
 * business
 *
 * Created by ChenTao on 2017/2/28.
 *
 * Copyright (c) 2017年 yidiandao. All rights reserved.
 */

package com.yidiandao.business.ui.widget.listview.displaylistitem;

import android.app.Activity;
import android.content.Context;
import android.view.View;

import com.yidiandao.business.R;
import com.yidiandao.business.data.bean.Order;
import com.yidiandao.business.data.response.OrderDetailResponse;
import com.yidiandao.business.ui.orderabout.logistics.LogisticsInfoActivity;
import com.yidiandao.business.ui.widget.listview.DisplayListItem;
import com.yidiandao.business.ui.widget.listview.viewholder.OrderDetailProgressHolder;
import com.yidiandao.business.utils.UIUtils;

/** 订单详情 进度 */
public class OrderDetailProgressListItem
        extends DisplayListItem<OrderDetailProgressHolder, OrderDetailResponse.Data> {

    public OrderDetailProgressListItem(OrderDetailResponse.Data s) {
        super(s);
    }

    @Override
    public void onShow(final Context context, OrderDetailProgressHolder holder) {
        final Order bean = data.getOrder();
        //订单状态
        holder.mTvStatus.setText(
                UIUtils.getString(R.string.order_detail_info_status, bean.getNow_order_status()));
        //订单编号
        holder.mTvOrderSn.setText(
                UIUtils.getString(R.string.order_detail_info_num, bean.getOrderSn()));
        //配送信息
        holder.mTvInfo.setText(data.getOrder().getLogistics().getMsg());
        //时间
        holder.mTvTime.setText(data.getOrder().getLogistics().getTime());
        holder.mLlInfo.setOnClickListener(
                new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        LogisticsInfoActivity.actionStart((Activity) context, bean.getOrderId());
                    }
                });
    }

    @Override
    public String getDisplayItemTag() {
        return OrderDetailProgressListItem.class.getSimpleName();
    }

    @Override
    public Class<OrderDetailProgressHolder> getViewHolderClazz() {
        return OrderDetailProgressHolder.class;
    }
}
